package com.bjtech.web.action.management;

import com.bjtech.dao.BaseStationInfoDao;
import com.bjtech.domain.BaseStationInfo;
import com.bjtech.domain.query.BaseStationInfoQuerySpec;
import com.bjtech.web.action.LyheatBaseAction;

public class BaseStationInfoAction extends LyheatBaseAction {

	private static final long serialVersionUID = 1L;
	private BaseStationInfoDao baseStationInfoDao;
	private BaseStationInfoQuerySpec selectBean;
	
	public void prepare() throws Exception {

	}
	
	public BaseStationInfoAction() throws Exception{
		model = new BaseStationInfo();
		selectBean = new BaseStationInfoQuerySpec();
	}
	
	public void setBaseStationInfoDao(BaseStationInfoDao baseStationInfoDao) {
		this.baseStationInfoDao = baseStationInfoDao;
	}

	public String execute(){
		return this.list();
	}
	
	public String list(){
		selectBean.queryParamString();
		list = this.baseStationInfoDao.selectEntityPaginatedList(new BaseStationInfo(),selectBean);
		return "list";
	}
	
	public String add(){
		return "edit";
	}
	
	public String save(){
		BaseStationInfo entity = (BaseStationInfo)model;
		if(entity.getId()==null){
			baseStationInfoDao.insertEntity(entity);
		}else{
			baseStationInfoDao.updateEntity(entity);
		}
		return "success";
	}
	
	public String edit(){
		model = this.baseStationInfoDao.selectEntity(new BaseStationInfo(),id);
		return "edit";
	}

	public String view(){
		model = this.baseStationInfoDao.selectEntity(new BaseStationInfo(),id);
		return "view";
	}
	
	public String delete(){
		model = this.baseStationInfoDao.deleteEntity(new BaseStationInfo(),id);
		return "success";
	}
	
	public BaseStationInfoQuerySpec getSelectBean() {
		return selectBean;
	}

	public void setSelectBean(BaseStationInfoQuerySpec selectBean) {
		this.selectBean = selectBean;
	}
}
